package com.yjs.app.trade.web.controller.business;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yjs.app.trade.core.util.PinYinUtil;
import com.yjs.app.trade.core.util.StringUtils;
import com.yjs.app.trade.entity.base.util.Page;
import com.yjs.app.trade.entity.bean.MemberSearch;
import com.yjs.app.trade.entity.bean.ProductNetPrice;
import com.yjs.app.trade.entity.bean.ProductPrice;
import com.yjs.app.trade.service.service.business.product.ProductService;
import com.yjs.app.trade.web.controller.base.BaseController;
import com.yjs.app.trade.web.controller.base.util.Result;

import net.sf.json.JSONObject;

/**
 * 发票相关控制层
 * 
 * @author Administrator
 *
 */
@Controller
@RequestMapping(value = "/app/business/product")
public class ProductController extends BaseController {

	@Autowired
	ProductService productService;

	@RequestMapping(value = "/findBuyerDrugNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findBuyerDrugNetPrice(HttpServletRequest request, Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data) {
		JSONObject jsonObject = dpackData(data);
		page.setPageNo(jsonObject.getInt("pageNo"));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (jsonObject.get("productName") != null) {
			if (StringUtils.isAllChinese(jsonObject.getString("productName"))) {
				productNetPrice.setProductName(jsonObject.getString("productName"));
			} else {
				productNetPrice.setProductNamePY(PinYinUtil.cn2py(jsonObject.getString("productName")).toUpperCase());
			}
		}
		if (jsonObject.get("dosageformName") != null) {
			productNetPrice.setDosageformName(jsonObject.getString("dosageformName"));
		}
		if (jsonObject.get("drugPackage") != null) {
			productNetPrice.setDrugPackage(jsonObject.getString("drugPackage"));
		}
		if (jsonObject.get("packSpecificationName") != null) {
			productNetPrice.setPackSpecificationName(jsonObject.getString("packSpecificationName"));
		}
		if (jsonObject.get("producter") != null) {
			productNetPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("sellerName") != null) {
			productNetPrice.setSellerName(jsonObject.getString("sellerName"));
		}
		if (jsonObject.get("drugCode") != null) {
			productNetPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("orderBy") != null) {
			page.setOrderBy(jsonObject.getString("orderBy"));
		}
		productNetPrice.setDay(30);
		return Result.csuccess(productService.findBuyerDrugNetPrice(page, productNetPrice));
	}

	@RequestMapping(value = "/findBuyerApparNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findBuyerApparNetPrice(Page<ProductNetPrice> page, ProductNetPrice productNetPrice) {
		return productService.findBuyerApparNetPrice(page, productNetPrice);
	}

	@RequestMapping(value = "/findSellerDrugNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findSellerDrugNetPrice(HttpServletRequest request, Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data) {
		JSONObject jsonObject = dpackData(data);
		productNetPrice.setSellerId(getUserMemberId(request));
		page.setPageNo(jsonObject.getInt("pageNo"));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (jsonObject.get("productName") != null) {
			if (StringUtils.isAllChinese(jsonObject.getString("productName"))) {
				productNetPrice.setProductName(jsonObject.getString("productName"));
			} else {
				productNetPrice.setProductNamePY(PinYinUtil.cn2py(jsonObject.getString("productName")).toUpperCase());
			}
		}
		if (jsonObject.get("dosageformName") != null) {
			productNetPrice.setDosageformName(jsonObject.getString("dosageformName"));
		}
		if (jsonObject.get("drugPackage") != null) {
			productNetPrice.setDrugPackage(jsonObject.getString("drugPackage"));
		}
		if (jsonObject.get("packSpecificationName") != null) {
			productNetPrice.setPackSpecificationName(jsonObject.getString("packSpecificationName"));
		}
		if (jsonObject.get("producter") != null) {
			productNetPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("sellerName") != null) {
			productNetPrice.setSellerName(jsonObject.getString("sellerName"));
		}
		if (jsonObject.get("drugCode") != null) {
			productNetPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("orderBy") != null) {
			page.setOrderBy(jsonObject.getString("orderBy"));
		}
		productNetPrice.setDay(30);
		return Result.csuccess(productService.findSellerDrugNetPrice(page, productNetPrice));
	}

	@RequestMapping(value = "/findSellerApparNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findSellerApparNetPrice(Page<ProductNetPrice> page, ProductNetPrice productNetPrice) {
		return productService.findSellerApparNetPrice(page, productNetPrice);
	}

	@RequestMapping(value = "/findDispatcherDrugNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findDispatcherDrugNetPrice(HttpServletRequest request, Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data) {
		JSONObject jsonObject = dpackData(data);
		if (getUserMemberType(request) == 2) {
			productNetPrice.setSellerId(getUserMemberId(request));
		} else if (getUserMemberType(request) == 3){
			productNetPrice.setDispatcherId(getUserMemberId(request));
		}
		page.setPageNo(jsonObject.getInt("pageNo"));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (jsonObject.get("productName") != null) {
			if (StringUtils.isAllChinese(jsonObject.getString("productName"))) {
				productNetPrice.setProductName(jsonObject.getString("productName"));
			} else {
				productNetPrice.setProductNamePY(PinYinUtil.cn2py(jsonObject.getString("productName")).toUpperCase());
			}
		}
		if (jsonObject.get("dosageformName") != null) {
			productNetPrice.setDosageformName(jsonObject.getString("dosageformName"));
		}
		if (jsonObject.get("drugPackage") != null) {
			productNetPrice.setDrugPackage(jsonObject.getString("drugPackage"));
		}
		if (jsonObject.get("packSpecificationName") != null) {
			productNetPrice.setPackSpecificationName(jsonObject.getString("packSpecificationName"));
		}
		if (jsonObject.get("producter") != null) {
			productNetPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("sellerName") != null) {
			productNetPrice.setSellerName(jsonObject.getString("sellerName"));
		}
		if (jsonObject.get("drugCode") != null) {
			productNetPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("orderBy") != null) {
			page.setOrderBy(jsonObject.getString("orderBy"));
		}
		productNetPrice.setDay(30);
		return Result.csuccess(productService.findDispatcherDrugNetPrice(page, productNetPrice));
	}
	
	/**
	 * 测试专用
	 */
	@RequestMapping(value = "/findDispatcherDrugNetPricet", method = RequestMethod.GET)
	@ResponseBody
	public Object findDispatcherDrugNetPricet(HttpServletRequest request, Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data) {
		return "0af6668c894691598d6ee21e8d99d1b91c8bbfabea3b54aa179115fa529e80d2e7bdddf8c64aa37d3473d64e211bb7425e35954cb9ebccd397f5d61764427b9910fe3973bacda8bb013baf344f913b49deca5cb16a36a21e62768b07b539df2b0b530aaec2ad5d2dc9e8923fb5d5e0fe2d18cd81f8b51ea6363b25b231976bdb6e550094576d366eb623b315c28e5ab1e0384ab1093c50fe028167d6c30d897f47bc333ebe8fe8d00cb8aa90b4bebb02d4639b63c0b7a2bdbda71fedc490d10950b3093bf6fb85a159a0a3127e393c28306b60f343d39e6b04738376d0b8c7990793b9575be8104b2855e8a5b3eea40a0f6c3c71a70f96b69b7771ad240a8a12ef1c2f15fab8bfb1c72cd98f8c5882c7f3725262610b750adac0d70af3c2a8d3de191d569e0462c1f121645a114e66426481ca9c6229b8d0dd313ce6865e17b2770ba3f9a6b142d7dfebe632e1d8741fca567216843014598895702758cb29a03482821d1c5401417a0ecf872052ebbf07742c5c810922b49cf132fbf1dda6d3b789e1258c70460c22e6ad8161f2e72241722caeb1cf62ab007068f196ac61899404e375157c7bc79b7771ad240a8a12dfabc8e304bc47b9ad5adb14fd98a926c2184e6324a719f895e5e7428d0e7b046c2970500394a53c0baf637c6776798751a66a0fe136100abf972e0689c1f4d779fe9379c0184cecf44fd03c13b0ff0f77d403f654e2ae02f7eb05b07af8f2a84cb541c52f79f32aa7563879ff13d41f559bb5181c4d20295a193c60da0411565f52f95dd53834d7f8c2379c1ce9483765ef47ed429088a0de0674c958d57f3d38e0c98ddaed0d5cf73db4e886c89f595923996103876d498505470c935a7d73f8a6835e0ed598743482821d1c5401417088c2ed5cc1fc70d45be34bab703954c9669650642960af0d6b16a55727667bd5a0e8f64b73186b7ae16eef891699d2d24dbbbfd6c7583f39c71401f3a9fc7310bbfdf8ddce8d53f7f3a5fd10465f2bbd84e272cbe617c20bf36d682327b22861f75a46b5a99d564f58430232524699e4e05c98474297edfc2d71e1c4b2e9a733b82b0988ca5b0a0d417607786d2faf1d81a7eebfd07e684015ed742610aab006f2068ba9932433d3421a9d5eb9f8dba79e23ee994c737eb1377cd5a3afa812784d4b975c7a808cfa0f00b13fd6808b2e29a0a0ce2a8885b2cc1e619c77db1f9499b8d2de4bb539b21816b6faed9f7e048b7a21f52533de6f425d0ea9bfa6a68362fa94be17662504738376d0b8c7998cc79d0cc55353853592c674812b5466cc8a9a780178bcfec4f2b82a71ce1fa66dd45378e6e9007b50b3093bf6fb85a1773e30f0cc9c22439025e318d47ddcce8eaf677acab8bed2d7c9bf8d48f653175da343c7b2e4157029bb3d432f2001f0ccc9fd3f8d39874fd3421a9d5eb9f8db44747ca6c578278fd81207a1b03e5443a61f97992b837dc24b229d65015f7af895e3eace832e1ca7f883b854a0aa636b0bf36d682327b22861f75a46b5a99d564f58430232524699e4e05c98474297ede4a741089310a55133b82b0988ca5b0a0d417607786d2faf1d81a7eebfd07e684015ed742610aab006f2068ba9932433d3421a9d5eb9f8dba79e23ee994c737eb1377cd5a3afa812b74789912c00385f1f283c4386beca20a6136644b043608521f4286e42848544d0022bba42f75d74071ff64ce6c912eb5f3a01e7b1b2a21bb06278b1ba5606070d417607786d2faf344536d31aae1871018a5a11e69e06a9e4e05c98474297ed2de5274ead1c29788c7666697781666a560f3be1c5318c70e73d15f2637a279bd638ed33316b1440a219524c9f4fbc0bff5856952b19341d31f18d13564c1fc78674c60a06fb6220de3f6d560b673a95d50702d7283d4946b22bf73aeea047d96216a14d781a7e014edb4c28d107bbafad5adb14fd98a926c2184e6324a719f895e5e7428d0e7b046c2970500394a53c9b6cfe505191bd2751a66a0fe136100abf972e0689c1f4d779fe9379c0184cecf44fd03c13b0ff0f77d403f654e2ae02f7eb05b07af8f2a84cb541c52f79f32aa7563879ff13d41f0f47d2188c92c1c2dc1af8a41d91d60d30ed0aff67b11d7e407ea64859fe6930e045c84794961deb9d49fcefebd236c2a8e54202e39d5dcbbaf2b5517c5a71e34d1e689d882fbeaecef6b7493690f4ddfa02ad984bec2acfe3f092665d7107d71f60574308872e988c7666697781666a560f3be1c5318c70e73d15f2637a279bd638ed33316b1440a219524c9f4fbc0bff5856952b19341d31f18d13564c1fc78674c60a06fb6220de3f6d560b673a95d50702d7283d4946b22bf73aeea047d96216a14d781a7e014edb4c28d107bbafad5adb14fd98a926c2184e6324a719f895e5e7428d0e7b046c2970500394a53c81ee5b3009f3dd2b93781ca006b91d63bf972e0689c1f4d779fe9379c0184cecf44fd03c13b0ff0f77d403f654e2ae02f7eb05b07af8f2a84cb541c52f79f32aa7563879ff13d41f9d12a1db8690a028dc1af8a41d91d60d30ed0aff67b11d7e4c1d6a11fcef29d9e045c84794961deb7ca154d6abe51d655291688c211487d11aad84b936e535b9b330d3ac62aa8c5e14deb73d4f9a8235566a0ae558fc5576ba23dabc0e41b2efcb42b2bfa6bb34969bbc259640ddc630e3f092665d7107d7c48b6580ee9c4d3cb75572e289c736c439093f7b7aaa1a719b8674e825f09ba1d484bb57eb70203721f6f0369f4da79a4bed79b71fe1fb4290eb2cbd2b9a525aa90dc6a2707cb58dc4d1267802c1bc7c1093bdc67bde6ed9bf5ba769cbd0eec86e364011ab95b5f3e8aa38ec9693004a0fa712ca4604f5946bd3ac5adece0df61583d7edc416023340a8945314281ec8bc562389cf5407fdef3fa059971b73a970997bfd69d21e5bc5c10b0c8c75a9e09a3fe2d51d4378dcd21548bf055acbfb45785eb2faa8cc358ccf081fe3be5d285f52f95dd53834d7256872ed088052c565ef47ed429088a05533d05a8ddcc86738e0c98ddaed0d5cf73db4e886c89f595923996103876d498505470c935a7d734e72ffa732f8407f3c64f708d12d19c67248894e1eef0e89d6666cb6ded58e08636e67d1302b66c5d24dbbbfd6c7583f39c71401f3a9fc7310bbfdf8ddce8d53f7f3a5fd10465f2bbd84e272cbe617c2490c6bf707a56a016e24ba3b835f43f86a51f09326fbc51c7e6a338ff5bd944ed5e951e7d648a05fa73a3c1167211752c9710eb69fbf6a9a5a24c176b1569e0551c562b68633302b9a1e070a0da155b159733ef3ca44df722ed72906e37ac30534d6b23f03ede50cbc57613f397cb1b6d1e443eff7a22e56860bbd991c413a4a33ef42337d71a6e99490d896885ccabd03d47668f3181a5a771ed73c59ecea6b21512af49eb05b08b8c880b76c106d99763ff9e6c17fcbf26f425d0ea9bfa6a68362fa94be176625de0cd02ccbcc30436d32006f22b7cdc7d0f619e4af9c2462b04c357b73f3cd8f8ee6c93e1491fba183daa761feb96a0e586af86b44bab7ee6d2c378ea61aab2a9cf132fbf1dda6d3b789e1258c70460c22e6ad8161f2e72241722caeb1cf62ab007068f196ac61899404e375157c7bc79b7771ad240a8a12dfabc8e304bc47b9ef1c2f15fab8bfb11e8f316fca9285bff53755e6fdbd61616a06b76f160e1f823652f256d6f9906186a0734174942d8ad4639b63c0b7a2bdbda71fedc490d10950b3093bf6fb85a1b84ba65af4b58b5e306b60f343d39e6b04738376d0b8c7990793b9575be8104b2855e8a5b3eea40a0f6c3c71a70f96b69b7771ad240a8a12ef1c2f15fab8bfb138d0692de93aad716a4fa92837def02ab621b067e7fc4a3022f7bfbc1e80826fb563ed62e3dc02fecd511aa950570118b25d868d2ef7eba47c7e8cab905964845798ddc9890d377253f068d73094ebf612a8b6cc59a354f044fdd5c5dcd5032fc12012db4ce66d033c9c77888a96ace6b75572e289c736c439093f7b7aaa1a713d0ed1c7f13e0f9f5e8621e9bb46f6a3663002551d544fd91de38ee9a22c6dd6281613bf7310592b53008ac9efb5d1ff3b2116d1ed803099a750a900c2b3856a5703648cce149e3c9912626060f34816c4c3e38941f219d44b5b5df56b3cf5c3421927f6db4eb34467575a075a3564d6194bec52861f2659586af86b44bab7eebfd787a935d9101296516e6ded94b94e3db5126b6a233a2664852acfd92a2b1cc004f8578e9c248e73c6246f1030cd601cdca43bf1d6a47e490c6bf707a56a01790663c135866e9d6ba28fd48513c62e2e29a0a0ce2a8885a79786bf3f495a279499b8d2de4bb5399c344b4c404a2449ca2cb70cde8e214b6f425d0ea9bfa6a68362fa94be176625de0cd02ccbcc3043bdbe35336ce90b3b646ae84a31703f9b77eb7ea2cca570bc3dbacdb4e375e5eb3482821d1c540141fc1dcc79004e1792d1d4d6c1299dd3aacbf1d45f2d6d838bdfabb4b31cb08b336e0e858e79d4769e663002551d544fd91de38ee9a22c6dd6281613bf7310592b53008ac9efb5d1ff3b2116d1ed803099a750a900c2b3856a5703648cce149e3c9912626060f3481615d529c80d24c5c6fa88328993bcf60640be3930d084b42689df7da698367570b9920bdddb723346175a45b083cae222b003ed4a2d90c60833bfca62785403af101d43550d495eda52d7831c97590ba0e4b6ec14e64c578e8aa325997cc874a227ca6cd42a16100d7cb3f38ded801ad5ad7fac3ef64cc8562f52c22acf9f743ca9057a62cc3d01a491ed1f8161611808d274cca4cb169c346567bfbe9a00ea2b";
	}

	@RequestMapping(value = "/findDispatcherApparNetPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findDispatcherApparNetPrice(Page<ProductNetPrice> page, ProductNetPrice productNetPrice) {
		return productService.findDispatcherApparNetPrice(page, productNetPrice);
	}
	
	@RequestMapping(value = "/findDispathProductPriceAdjust", method = RequestMethod.GET)
	@ResponseBody
	public Object findDispathProductPriceAdjust(Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data, HttpServletRequest request) {
		JSONObject jsonObject = dpackData(data);
		if (getUserMemberType(request) == 2) {
			productNetPrice.setSellerId(getUserMemberId(request));
		} else if (getUserMemberType(request) == 3){
			productNetPrice.setDispatcherId(getUserMemberId(request));
		}
		page.setPageNo(jsonObject.getInt("pageNo"));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (StringUtils.strIsNotNull(jsonObject.get("increase"))) {
			productNetPrice.setIncrease(jsonObject.getString("increase"));
		}
		if (jsonObject.get("dayInterval") != null) {
			productNetPrice.setDayInterval(jsonObject.getInt("dayInterval"));
		}
		if (jsonObject.get("tradeName") != null) {
			productNetPrice.setTradeName(jsonObject.getString("tradeName"));
		}
		if (jsonObject.get("producter") != null) {
			productNetPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("drugCode") != null) {
			productNetPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("sort") != null) {
			productNetPrice.setSort(jsonObject.getString("sort"));
		}
		productNetPrice.setDayInterval(productNetPrice.getDayInterval() == null ? 30 : productNetPrice.getDayInterval());
		return Result.csuccess(productService.findDispathProductPriceAdjust(page, productNetPrice));
	}
	
	@RequestMapping(value = "/findProductByParam", method = RequestMethod.GET)
	@ResponseBody
	public Object findProductByParam(Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data, HttpServletRequest request) {
		JSONObject jsonObject = dpackData(data);
		int memberType = getUserMemberType(request);
		if (memberType == 2) {
			productNetPrice.setSellerId(getUserMemberId(request));
		}
		page.setPageNo(1);
		page.setPageSize(1000);
		/*if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}*/
		if (jsonObject.get("productName") != null) {
			productNetPrice.setProductName(jsonObject.getString("productName"));
		}
		return Result.csuccess(productService.findProductByParam(page, productNetPrice));
	}
	
	@RequestMapping(value = "/unionProductAudit", method = RequestMethod.GET)
	@ResponseBody
	public Object unionProductAudit(String data, HttpServletRequest request, Page<MemberSearch> page, MemberSearch memberSearch) {
		memberSearch.setUnionId(getUserMemberId(request));
		if (StringUtils.isNotBlank(data)) {
			JSONObject jsonObject = dpackData(data);
			if (StringUtils.strIsNotNull(jsonObject.get("pageSize"))) {
				page.setPageSize(jsonObject.getInt("pageSize"));
			}
			if (StringUtils.strIsNotNull(jsonObject.get("pageNo"))) {
				page.setPageNo(jsonObject.getInt("pageNo"));
			}
		}
		return Result.csuccess(productService.unionProductAudit(page, memberSearch));
	}
	
	@RequestMapping(value = "/findProductPrice", method = RequestMethod.GET)
	@ResponseBody
	public Object findProductPrice(HttpServletRequest request, Page<ProductPrice> page, ProductPrice productPrice, String data) {
		JSONObject jsonObject = dpackData(data);
		page.setPageNo(jsonObject.getInt("pageNo"));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (jsonObject.get("drugCode") != null) {
			productPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("genericName") != null) {
			productPrice.setGenericName(jsonObject.getString("genericName"));
		}
		if (jsonObject.get("producter") != null) {
			productPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("saler") != null) {
			productPrice.setSaler(jsonObject.getString("saler"));
		}
		if (jsonObject.get("specificationName") != null) {
			productPrice.setSpecificationName(jsonObject.getString("specificationName"));
		}
		if (jsonObject.get("regionName") != null) {
			productPrice.setRegionName(jsonObject.getString("regionName"));
		}
		if (jsonObject.get("isChangePrice") != null) {
			productPrice.setIsChangePrice(jsonObject.getString("isChangePrice"));
		}
		if (jsonObject.get("tradeName") != null) {
			productPrice.setTradeName(jsonObject.getString("tradeName"));
		}
		if (jsonObject.get("remarkFlag") != null) {
			productPrice.setRemarkFlag(jsonObject.getString("remarkFlag"));
		}
		if (jsonObject.get("productType") != null) {
			productPrice.setProductType(jsonObject.getString("productType"));
		}
		if (jsonObject.get("isNewListed") != null) {
			productPrice.setIsNewListed(jsonObject.getString("isNewListed"));
		}
		if (jsonObject.get("beginDt") != null) {
			productPrice.setBeginDt(jsonObject.getString("beginDt"));
		}
		if (jsonObject.get("endDt") != null) {
			productPrice.setEndDt(jsonObject.getString("endDt"));
		}
		Page<?> findProductPrice = productService.findProductPrice(page, productPrice);
		return Result.csuccess(findProductPrice);
	}

	/**
	 * 查询消息详情
	 * @author fgdgf7d4gfd
	 * @param data
	 * @return
	 */
	@RequestMapping(value = "/findMessageDetail", method = RequestMethod.GET)
	@ResponseBody
	public Object findMessageDetail(String data){
		JSONObject jsonObject = dpackData(data);
		String type = jsonObject.getString("MESSAGE_TYPE");
		if(type != null && type != ""){
			Map<String,Object> map=new HashMap<String, Object>();
			String msgId = jsonObject.getString("MESSAGE_NUMBER");
			switch (type) {
			case "7":
				//查询议价消息
				map=productService.findBargain(msgId);
				break;
			case "8":
				//查询GMP消息
				map=productService.findGMP(msgId);
				break;
			case "9":
				//查询进口代理协议		
				map=productService.findAgencyContract(msgId);
				break;
			case "10":
				//查询产品审核
				map=productService.findProductAudit(msgId);
				break;
			default:
				return Result.cfail("","消息匹配失败");	
			}
			return Result.csuccess(map);
		}else{
			return Result.cfail("","消息类型为空");
		}
		
		
	}
	
	@RequestMapping(value = "/findSellerProductList", method = RequestMethod.GET)
	@ResponseBody
	public Object findSellerProductList(HttpServletRequest request, Page<ProductNetPrice> page, ProductNetPrice productNetPrice, String data) {
		JSONObject jsonObject = dpackData(data);
		page.setPageNo(jsonObject.getInt("pageNo"));
		productNetPrice.setSellerId(getUserMemberId(request));
		if (jsonObject.get("pageSize") != null) {
			page.setPageSize(jsonObject.getInt("pageSize"));
		}
		if (jsonObject.get("drugCode") != null) {
			productNetPrice.setDrugCode(jsonObject.getString("drugCode"));
		}
		if (jsonObject.get("productName") != null) {
			productNetPrice.setProductName(jsonObject.getString("productName"));
		}
		if (jsonObject.get("producter") != null) {
			productNetPrice.setProducter(jsonObject.getString("producter"));
		}
		if (jsonObject.get("productStatus") != null) {
			productNetPrice.setProductStatus(jsonObject.getString("productStatus"));
		}
		return Result.csuccess(productService.findSellerProductList(page, productNetPrice));
	}
}
